package com.link.base.base.consumer.dao.mybatis.mapper;

import com.link.base.base.consumer.model.ImpOrder;
import com.link.core.basic.dao.mapper.BasicMapper;

import java.util.List;

/**
 * 处理导入数据，将记录写入临时表，并进行校验，校验成功的记录将生成对应的客户及订单和产品
 *
 * @author Li Yang
 * 2018-04-28
 */
public interface ImpData2AccntMapper extends BasicMapper<ImpOrder> {
    /**
     * 查询订单头临时表是否包含此订单
     *
     * @param record
     * @return
     * @throws Exception
     */
    public ImpOrder queryTempOrderByOrderNum(ImpOrder record) throws Exception;

    /**
     * 根据查出的临时表订单头id删除订单临时头、行表
     *
     * @param record
     * @throws Exception
     */
    public void deleteTempOrder(ImpOrder record) throws Exception;

    /**
     * 删除订单行临时表记录
     *
     * @param record
     * @throws Exception
     */
    public void deleteTempOrderItem(ImpOrder record) throws Exception;

    /**
     * 根据导入excel字段，新建临时订单头
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderHeadInsert(ImpOrder record) throws Exception;

    /**
     * 根据导入excel字段，新建订单行
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderItemInsert(ImpOrder record) throws Exception;

    /**
     * 查询当前用户所插入临时表的订单头
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<ImpOrder> queryImportOrderHeadPage(ImpOrder record) throws Exception;

    /**
     * 查询当前用户所插入临时表的订单行
     *
     * @param record
     * @return
     * @throws Exception
     */
    public List<ImpOrder> queryImportOrderItemPage(ImpOrder record) throws Exception;

    /**
     * 更新订单头
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderHeadUpdate(ImpOrder record) throws Exception;

    /**
     * 更新订单行
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderItemUpdate(ImpOrder record) throws Exception;

    /**
     * 更新检查和同步状态
     *
     * @param record
     * @throws Exception
     */
    public void tempOrderStatusUpdate(ImpOrder record) throws Exception;

    /**
     * 删除当前用户导入的所有订单数据
     *
     * @param record
     * @throws Exception
     */
    public void cancelImport(ImpOrder record) throws Exception;
}
